<template>
  <div class="dashboard-container">
    <div class="cards-wrapper">
      <el-row :gutter="20">
        <el-col 
          v-for="(item, index) in cards" 
          :key="index"
          :xs="24" 
          :sm="12" 
          :md="8" 
          :lg="8" 
          :xl="6"
        >
          <router-link :to="routerTo[index]" class="card-link">
            <el-card 
            class="dashboard-card"
            :body-style="{ padding: '20px' }"
            shadow="hover"
          >
            <div class="card-content">
              <div class="card-icon">
                <el-icon :size="40" :color="iconColors[index]">
                  <component :is="item.icon" />
                </el-icon>
              </div>
              <h3 class="card-title">{{ item.title }}</h3>
            </div>
          </el-card>
          </router-link>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import {
  OfficeBuilding,
  User,
  Notebook,
  Collection,
  DataAnalysis,
  Histogram
} from '@element-plus/icons-vue'
const routerTo=ref(["/dept","/emp","/stu","/clazz","/empReport","/stuReport"]);
const cards = ref([
  { title: '部门管理', icon: OfficeBuilding },
  { title: '员工管理', icon: User },
  { title: '学生管理', icon: Notebook },
  { title: '班级管理', icon: Collection },
  { title: '员工信息统计', icon: DataAnalysis },
  { title: '学生信息统计', icon: Histogram }
])

const iconColors = ref([
  '#409EFF',
  '#67C23A',
  '#E6A23C',
  '#F56C6C',
  '#909399',
  '#9c27b0'
])
</script>

<style scoped>
.card-link{
  text-decoration: none;
}

.dashboard-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #f0f2ff 0%, #f6f7ff 100%);
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cards-wrapper {
  max-width: 1200px;
  width: 100%;
}

.dashboard-card {
  margin-bottom: 20px;
  border-radius: 12px;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  border: none;
}

.dashboard-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
}

.card-icon {
  margin-bottom: 15px;
}

.card-title {
  color: #333;
  font-size: 18px;
  font-weight: 500;
  margin: 0;
  text-align: center;
}

@media (max-width: 768px) {
  .card-title {
    font-size: 16px;
  }
}
</style>